#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
using namespace std;



int main()
{
	string s1("hello nowcoder");
	int count = 0;
	string::reverse_iterator it = s1.rbegin();
	//while (it != s1.rend())
	//{
	//	if (*it != ' ') count++;
	//	it++;
	//}
	//cout << *it << endl;

	while (*it != ' ')
	{
		count++;
		it++;
	}
	cout<< count << endl; 

	return 0;
}

//int main1()
//{
//	string s1("ha hellow");
//
//	s1.append(" reader");
//	cout << s1 << endl;
//
//	s1.erase(0, 3);
//	cout << s1 << endl;
//
//	std::string::iterator it1 = s1.begin();
//	std::string::const_iterator it2 = s1.cbegin();
//
//	std::string::reverse_iterator it3 = s1.rbegin();
//	std::string::const_reverse_iterator it4 = s1.crbegin();
//
//	return 0;
//}